package com.algorithm.thePrimaryAlgorithm;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;

@Slf4j
public class ArraySulotionLC08 {
    public void moveZeroes(int[] nums) {
        int left = 0;
        int right = 1;

        while (right< nums.length) {
            if (nums[left] == 0 && nums[right] != 0) {
                int temp = nums[left];
                nums[left] = nums[right];
                nums[right] = temp;
                left++;
                right++;
            }else if (nums[left] == 0 && nums[right] == 0){
                right++;
            }else if (nums[left] != 0){
                left++;
                right++;
            }

        }
    }

    @Test
    public void test(){
        int [] nums = {0,0,0,3,12};
        moveZeroes(nums);
        log.info("over");
    }
}
